const axios = require('axios');
const key = `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`
export async function generateChineseText(prompt) {
    const response = await axios.post('https://api.openai.com/v1/engines/text-davinci-003/completions', {
        prompt: prompt,
        max_tokens: 100, // 调整生成的长度
        temperature: 0.7, // 控制随机性
        n: 1,
        stop: null,
    }, {
        headers: {
            'Authorization': `Bearer ${key}`,
            'Content-Type': 'application/json',
        }
    });

    return response.data.choices[0].text.trim();
}